//
//  FirmaInterventoViewController.m
//  InterventixApp
//
//  Created by Diego Falcinelli on 22/05/13.
//
//

#import "FirmaInterventoViewController.h"
#import "NSData+Conversion.h"
#import "Firma2InterventoViewController.h"


@interface FirmaInterventoViewController ()

@end

@implementation FirmaInterventoViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidAppear:(BOOL)animated{
    if(self.intervento.firma != nil){
        @try {
            self.firma.image = [UIImage imageWithData:self.intervento.firma];
            self.size.text = [NSByteCountFormatter stringFromByteCount:self.intervento.firma.length countStyle:NSByteCountFormatterCountStyleDecimal];
            //self.size.text = [NSString stringWithFormat:@"%d", (int)self.intervento.firma.length];
        }
        @catch (NSException *exception) {
            
        }
        @finally {
            
        }
        
    }
}

-(IBAction) indietro{
	[[self navigationController] popViewControllerAnimated:YES];
}

-(IBAction) modifica{
	Firma2InterventoViewController *open = [self.storyboard instantiateViewControllerWithIdentifier:@"Firma2InterventoViewController"];
    open.intervento = self.intervento;
    open.user = self.user;
    [self.navigationController pushViewController:open animated:TRUE];
}

@end
